<%@ include file="/common/taglibs.jsp" %>

<head>
    <title><fmt:message key="userList.title"/></title>
    <meta name="menu" content="AdminMenu"/>
</head>

<div>
    <h2><fmt:message key="userList.heading"/></h2>

    <form method="get" action="${ctx}/admin/users" id="searchForm" class="form-search">
    <div id="search" class="input-append">
        <input type="text" size="20" name="q" id="query" value="${param.q}"
               placeholder="<fmt:message key="search.enterTerms"/>" class="input-medium search-query"/>
        <button id="button.search" class="btn" type="submit">
            <i class="icon-search"></i>
            <fmt:message key="button.search"/>
        </button>
    </div>
    </form>

    <div id="actions" class="form-actions">
        <a class="btn btn-primary" href="<c:url value='/editUser?from=list'/>" >
            <i class="icon-plus icon-white"></i> <fmt:message key="button.add"/>
        </a>
        <a class="btn btn-primary" href="<c:url value="/admin/ldapUsers"/>">
            <i class="icon-plus icon-white"></i> <fmt:message key="button.ldap"/>
        </a>
        <a class="btn" href="<c:url value="/mainMenu"/>">
            <i class="icon-ok"></i> <fmt:message key="button.done"/>
        </a>
    </div>

    <display:table name="users" cellspacing="0" cellpadding="0" requestURI=""
                   defaultsort="1" id="user" pagesize="25" class="table table-condensed table-striped table-hover" export="true">
        <display:column titleKey="user.photo" style="width: 10%" media="html">
        	<c:choose>
        		<c:when test="${ user.loginType eq 'LDAP' }">
        			<img src="${ ctx }/thumbnailPhotoLdap?username=${ user.username }"/>
        		</c:when>
        		<c:when test="${ user.loginType eq 'INTERNAL' }">
        			<img src="${ ctx }/thumbnailPhoto?username=${ user.username }"/>
        		</c:when>
        	</c:choose>
        </display:column>  
        <display:column property="username" escapeXml="true" sortable="true" titleKey="user.username" style="width: 15%"
                        url="/editUser?from=list" paramId="id" paramProperty="id"/>
        <display:column escapeXml="true" sortable="true" titleKey="user.loginType" style="width: 20%">
        	<fmt:message key="loginType.${user.loginType}"/>
        </display:column>
        <display:column titleKey="activeUsers.fullName" sortable="true" style='width: 34%'>
            <c:out value="${user.fullName}" escapeXml="true"/>
            <c:if test="${not empty user.email}">
                <a href="mailto:<c:out value="${user.email}"/>">
                    <img width="16px" src="<c:url value="/images/iconEmail.png"/>"
                         alt="<fmt:message key="icon.email"/>" class="icon"/></a>
            </c:if>
        </display:column>
<!--         Puntos del Cliente -->
         <display:column titleKey="Puntos" sortable="true" style='width: 34%'>
            <c:out value="${user.puntos}" escapeXml="true"/>
         </display:column>
      
       <display:column property="phoneNumber" sortable="true" titleKey="user.phone" style="width: 25%" autolink="true"
                        media="html"/>
        <display:column property="email" titleKey="user.email" media="csv xml excel pdf"/>
  
  
        <display:column sortProperty="enabled" sortable="true" titleKey="user.enabled"
                        style="width: 16%; padding-left: 15px" media="html">
            <input type="checkbox" disabled="disabled" <c:if test="${user.enabled}">checked="checked"</c:if>/>
        </display:column>

        <display:setProperty name="paging.banner.item_name"><fmt:message key="userList.user"/></display:setProperty>
        <display:setProperty name="paging.banner.items_name"><fmt:message key="userList.users"/></display:setProperty>

        <display:setProperty name="export.excel.filename" value="User List.xls"/>
        <display:setProperty name="export.csv.filename" value="User List.csv"/>
        <display:setProperty name="export.pdf.filename" value="User List.pdf"/>
    </display:table>
</div>
